home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / espial.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  11KB  |  353 lines

  1. /***************************************************************************
  2.  
  3. Espial memory map (preliminary)
  4.  
  5. MAIN CPU:
  6.  
  7. 0000-4fff ROM
  8. 5800-5fff RAM
  9. 8000-800f sprites code (bits 1-7) and double height (bit 0)
  10. 8010-801f sprites X
  11. 8400-87ff Video RAM
  12. 8800-880f sprites flip x (bit 2) and flip y (bit 3)
  13. 8c00-8fff Attribute RAM
  14. 9000-900f sprites Y
  15. 9010-901f sprites color
  16. 9020-903f column scroll
  17. 9400-97ff Color RAM
  18. c000-cfff ROM
  19.  
  20. read:
  21. 6081      IN0
  22. 6082      IN1
  23. 6083      IN2
  24. 6084      IN3
  25. 6090      read command back from sound CPU
  26. 7000      ?
  27.  
  28. write:
  29. 6081      ? - written to twice when the text during the self-test is drawn onscreen
  30. 6090      write command to sound CPU
  31. 7000      watchdog reset
  32. 7100      NMI interrupt acknowledge/enable
  33. 7200      flip screen
  34.  
  35. Interrupts: VBlank -> NMI.
  36.             IRQ -> send sound commands to sound cpu. Runs in interrupt mode 1
  37.  
  38. SOUND CPU:
  39. 0000-1fff ROM
  40. 2000-23ff RAM
  41.  
  42. read:
  43. 6000      read command from main CPU
  44.  
  45. write:
  46. 4000      NMI enable
  47. 6000      write command back to main CPU
  48.  
  49. Interrupts: IRQs are triggered by writes to the sound_command location 0x6000 - im 1
  50.             NMIs occur regularly to process and play the sounds
  51.  
  52. I/0 ports:
  53. write
  54. 00        8910  control
  55. 01        8910  write
  56. A ?
  57. B ?
  58.  
  59. ***************************************************************************/
  60.  
  61. #include "driver.h"
  62. #include "vidhrdw/generic.h"
  63.  
  64.  
  65.  
  66. extern unsigned char *espial_attributeram;
  67. extern unsigned char *espial_column_scroll;
  68. WRITE_HANDLER( espial_attributeram_w );
  69. void espial_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  70. void espial_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  71.  
  72. void espial_init_machine(void);
  73. WRITE_HANDLER( zodiac_master_interrupt_enable_w );
  74. int  zodiac_master_interrupt(void);
  75. WRITE_HANDLER( zodiac_master_soundlatch_w );
  76.  
  77.  
  78. static struct MemoryReadAddress readmem[] =
  79. {
  80.     { 0x0000, 0x4fff, MRA_ROM },
  81.     { 0x5800, 0x5fff, MRA_RAM },
  82.     { 0x7000, 0x7000, MRA_RAM },    /* ?? */
  83.     { 0x8000, 0x803f, MRA_RAM },
  84.     { 0x8400, 0x87ff, MRA_RAM },
  85.     { 0x8c00, 0x903f, MRA_RAM },
  86.     { 0x9400, 0x97ff, MRA_RAM },
  87.     { 0x6081, 0x6081, input_port_0_r },    /* IN0 */
  88.     { 0x6082, 0x6082, input_port_1_r },    /* IN1 */
  89.     { 0x6083, 0x6083, input_port_2_r },    /* IN2 */
  90.     { 0x6084, 0x6084, input_port_3_r },    /* IN3 */
  91.     { 0x6090, 0x6090, soundlatch_r },    /* the main CPU reads the command back from the slave */
  92.     { 0xc000, 0xcfff, MRA_ROM },
  93.     { -1 }    /* end of table */
  94. };
  95.  
  96. static struct MemoryWriteAddress writemem[] =
  97. {
  98.     { 0x0000, 0x4fff, MWA_ROM },
  99.     { 0x5800, 0x5fff, MWA_RAM },
  100.     { 0x6090, 0x6090, zodiac_master_soundlatch_w },
  101.     { 0x7000, 0x7000, watchdog_reset_w },
  102.     { 0x7100, 0x7100, zodiac_master_interrupt_enable_w },
  103.     { 0x8000, 0x801f, MWA_RAM, &spriteram, &spriteram_size },
  104.     { 0x8400, 0x87ff, videoram_w, &videoram, &videoram_size },
  105.     { 0x8800, 0x880f, MWA_RAM, &spriteram_3 },
  106.     { 0x8c00, 0x8fff, espial_attributeram_w, &espial_attributeram },
  107.     { 0x9000, 0x901f, MWA_RAM, &spriteram_2 },
  108.     { 0x9020, 0x903f, MWA_RAM, &espial_column_scroll },
  109.     { 0x9400, 0x97ff, colorram_w, &colorram },
  110.     { 0xc000, 0xcfff, MWA_ROM },
  111.     { -1 }    /* end of table */
  112. };
  113.  
  114.  
  115. static struct MemoryReadAddress sound_readmem[] =
  116. {
  117.     { 0x0000, 0x1fff, MRA_ROM },
  118.     { 0x2000, 0x23ff, MRA_RAM },
  119.     { 0x6000, 0x6000, soundlatch_r },
  120.     { -1 }    /* end of table */
  121. };
  122.  
  123. static struct MemoryWriteAddress sound_writemem[] =
  124. {
  125.     { 0x0000, 0x1fff, MWA_ROM },
  126.     { 0x2000, 0x23ff, MWA_RAM },
  127.     { 0x4000, 0x4000, interrupt_enable_w },
  128.     { 0x6000, 0x6000, soundlatch_w },
  129.     { -1 }    /* end of table */
  130. };
  131.  
  132. static struct IOWritePort sound_writeport[] =
  133. {
  134.     { 0x00, 0x00, AY8910_control_port_0_w },
  135.     { 0x01, 0x01, AY8910_write_port_0_w },
  136.     { -1 }    /* end of table */
  137. };
  138.  
  139.  
  140. INPUT_PORTS_START( espial )
  141.     PORT_START    /* IN0 */
  142.     PORT_DIPNAME( 0x01, 0x00, "Fire Buttons" )
  143.     PORT_DIPSETTING(    0x01, "1" )
  144.     PORT_DIPSETTING(    0x00, "2" )
  145.     PORT_DIPNAME( 0x02, 0x02, "CounterAttack" )    /* you can shoot bullets */
  146.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  147.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  148.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  149.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  150.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  151.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  152.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  153.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  154.  
  155.     PORT_START    /* IN1 */
  156.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  157.     PORT_DIPSETTING(    0x00, "3" )
  158.     PORT_DIPSETTING(    0x01, "4" )
  159.     PORT_DIPSETTING(    0x02, "5" )
  160.     PORT_DIPSETTING(    0x03, "6" )
  161.     PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coin_A ) )
  162.     PORT_DIPSETTING(    0x14, DEF_STR( 2C_1C ) )
  163.     PORT_DIPSETTING(    0x18, DEF_STR( 3C_2C ) )
  164.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  165.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  166.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
  167.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  168.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_6C ) )
  169.     PORT_DIPSETTING(    0x1c, DEF_STR( Free_Play ) )
  170.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) )
  171.     PORT_DIPSETTING(    0x00, "20k and every 70k" )
  172.     PORT_DIPSETTING(    0x20, "50k and every 100k" )
  173.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  174.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  175.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  176.     PORT_DIPNAME( 0x80, 0x00, "Test Mode" )    /* ??? */
  177.     PORT_DIPSETTING(    0x00, "Normal" )
  178.     PORT_DIPSETTING(    0x80, "Test" )
  179.  
  180.     PORT_START    /* IN2 */
  181.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  182.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  183.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  184.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  185.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  186.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  187.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  188.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  189.  
  190.     PORT_START    /* IN3 */
  191.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  192.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )
  193.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  194.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  195.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
  196.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
  197.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  198.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  199. INPUT_PORTS_END
  200.  
  201.  
  202.  
  203. static struct GfxLayout charlayout =
  204. {
  205.     8,8,    /* 8*8 characters */
  206.     768,    /* 768 characters */
  207.     2,    /* 2 bits per pixel */
  208.     { 0, 4 },    /* the two bitplanes for 4 pixels are packed into one byte */
  209.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },    /* bits are packed in groups of four */
  210.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  211.     16*8    /* every char takes 16 bytes */
  212. };
  213.  
  214. static struct GfxLayout spritelayout =
  215. {
  216.     16,16,    /* 16*16 sprites */
  217.     128,    /* 128 sprites */
  218.     2,    /* 2 bits per pixel */
  219.     { 0, 128*32*8 },    /* the two bitplanes are separated */
  220.     { 0, 1, 2, 3, 4, 5, 6, 7,
  221.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  222.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  223.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  224.     32*8    /* every sprite takes 32 consecutive bytes */
  225. };
  226.  
  227.  
  228. static struct GfxDecodeInfo gfxdecodeinfo[] =
  229. {
  230.     { REGION_GFX1, 0, &charlayout,    0, 64 },
  231.     { REGION_GFX2, 0, &spritelayout,  0, 64 },
  232.     { -1 } /* end of array */
  233. };
  234.  
  235.  
  236.  
  237. static struct AY8910interface ay8910_interface =
  238. {
  239.     1,    /* 1 chip */
  240.     1500000,    /* 1.5 MHZ?????? */
  241.     { 50 },
  242.     { 0 },
  243.     { 0 },
  244.     { 0 },
  245.     { 0 }
  246. };
  247.  
  248.  
  249.  
  250. static struct MachineDriver machine_driver_espial =
  251. {
  252.     /* basic machine hardware */
  253.     {
  254.         {
  255.             CPU_Z80,
  256.             3072000,    /* 3.072 Mhz */
  257.             readmem,writemem,0,0,
  258.             zodiac_master_interrupt,2
  259.         },
  260.         {
  261.             CPU_Z80,
  262.             3072000,    /* 2 Mhz?????? */
  263.             sound_readmem,sound_writemem,0,sound_writeport,
  264.             nmi_interrupt,4
  265.         }
  266.     },
  267.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  268.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  269.     espial_init_machine,
  270.  
  271.     /* video hardware */
  272.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  273.     gfxdecodeinfo,
  274.     256,256,
  275.     espial_vh_convert_color_prom,
  276.  
  277.     VIDEO_TYPE_RASTER,
  278.     0,
  279.     generic_vh_start,
  280.     generic_vh_stop,
  281.     espial_vh_screenrefresh,
  282.  
  283.     /* sound hardware */
  284.     0,0,0,0,
  285.     {
  286.         {
  287.             SOUND_AY8910,
  288.             &ay8910_interface
  289.         }
  290.     }
  291. };
  292.  
  293.  
  294.  
  295. /***************************************************************************
  296.  
  297.   Game driver(s)
  298.  
  299. ***************************************************************************/
  300.  
  301. ROM_START( espial )
  302.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  303.     ROM_LOAD( "espial.3",     0x0000, 0x2000, 0x10f1da30 )
  304.     ROM_LOAD( "espial.4",     0x2000, 0x2000, 0xd2adbe39 )
  305.     ROM_LOAD( "espial.6",     0x4000, 0x1000, 0xbaa60bc1 )
  306.     ROM_LOAD( "espial.5",     0xc000, 0x1000, 0x6d7bbfc1 )
  307.  
  308.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  309.     ROM_LOAD( "espial.1",     0x0000, 0x1000, 0x1e5ec20b )
  310.     ROM_LOAD( "espial.2",     0x1000, 0x1000, 0x3431bb97 )
  311.  
  312.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  313.     ROM_LOAD( "espial.8",     0x0000, 0x2000, 0x2f43036f )
  314.     ROM_LOAD( "espial.7",     0x2000, 0x1000, 0xebfef046 )
  315.  
  316.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  317.     ROM_LOAD( "espial.10",    0x0000, 0x1000, 0xde80fbc1 )
  318.     ROM_LOAD( "espial.9",     0x1000, 0x1000, 0x48c258a0 )
  319.  
  320.     ROM_REGION( 0x0200, REGION_PROMS )
  321.     ROM_LOAD( "espial.1f",    0x0000, 0x0100, 0xd12de557 ) /* palette low 4 bits */
  322.     ROM_LOAD( "espial.1h",    0x0100, 0x0100, 0x4c84fe70 ) /* palette high 4 bits */
  323. ROM_END
  324.  
  325. ROM_START( espiale )
  326.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  327.     ROM_LOAD( "2764.3",       0x0000, 0x2000, 0x0973c8a4 )
  328.     ROM_LOAD( "2764.4",       0x2000, 0x2000, 0x6034d7e5 )
  329.     ROM_LOAD( "2732.6",       0x4000, 0x1000, 0x357025b4 )
  330.     ROM_LOAD( "2732.5",       0xc000, 0x1000, 0xd03a2fc4 )
  331.  
  332.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  333.     ROM_LOAD( "2732.1",       0x0000, 0x1000, 0xfc7729e9 )
  334.     ROM_LOAD( "2732.2",       0x1000, 0x1000, 0xe4e256da )
  335.  
  336.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  337.     ROM_LOAD( "espial.8",     0x0000, 0x2000, 0x2f43036f )
  338.     ROM_LOAD( "espial.7",     0x2000, 0x1000, 0xebfef046 )
  339.  
  340.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  341.     ROM_LOAD( "espial.10",    0x0000, 0x1000, 0xde80fbc1 )
  342.     ROM_LOAD( "espial.9",     0x1000, 0x1000, 0x48c258a0 )
  343.  
  344.     ROM_REGION( 0x0200, REGION_PROMS )
  345.     ROM_LOAD( "espial.1f",    0x0000, 0x0100, 0xd12de557 ) /* palette low 4 bits */
  346.     ROM_LOAD( "espial.1h",    0x0100, 0x0100, 0x4c84fe70 ) /* palette high 4 bits */
  347. ROM_END
  348.  
  349.  
  350.  
  351. GAMEX( 1983, espial,  0,      espial, espial, 0, ROT0, "[Orca] Thunderbolt", "Espial (US?)", GAME_NO_COCKTAIL )
  352. GAMEX( 1983, espiale, espial, espial, espial, 0, ROT0, "[Orca] Thunderbolt", "Espial (Europe)", GAME_NO_COCKTAIL )
  353.